const express = require('express');
const https = require('https');
const fs = require('fs');
const app = express();

const path = require('path');
const PORT = 8443;


app.use(express.static(path.join(__dirname, './static/')));

const options = {
    key: fs.readFileSync(path.join(__dirname, '../cofig/server.key')),
    cert: fs.readFileSync(path.join(__dirname, '../cofig/server.crt'))
};


module.exports = function () {
    https.createServer(options, app).listen(PORT, () => {
        console.log(`server is running on https://localhost:${PORT}`);
    });

    return app;
}
